package com.group11.resume.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.group11.resume.entity.EduBg;
import com.group11.resume.mapper.EduBgMapper;
import com.group11.resume.service.EduBgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EduBgServiceImpl implements EduBgService {
    @Autowired
    private EduBgMapper eduBgMapper;

    public void addEduBg(List<EduBg> eduBgs) {
        eduBgMapper.insert(eduBgs);
    }

    public List<EduBg> listByResumeId(Integer resumeId) {
        LambdaQueryWrapper<EduBg> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(EduBg::getResumeId, resumeId);
        return eduBgMapper.selectList(queryWrapper);
    }

    public void deleteEduBg(List<Integer> resumeIds) {
        eduBgMapper.delete(new QueryWrapper<EduBg>().in("resume_id", resumeIds));
    }
}
